package com.itheima.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class Demo02 {

    public static void main(String[] args) throws ParseException {

        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String s = sdf.format(date);
        System.out.println(s);
        String s2="2850年3月31日";
        Date date1 = sdf.parse(s2);
        System.out.println(date1);

        LocalDateTime now = LocalDateTime.now();
        System.out.println(now.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
        String s5="2850年03月31日";
        LocalDate date8 = LocalDate.parse(s5, DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
        System.out.println(date8);
    }
}
